package com.guigu.design;

/**
 * @description:
 * @author: lizhenhua05
 * @created: 2020/12/30 21:21
 */
//有构造器依赖倒转，setter方法，接口依赖倒转
public class DependenceReversa {
    public static void main(String[] args) {
        MyPlay myPlay = new MyPlay();
        myPlay.play(new ChangHong());

    }

}

interface Play{
    public void play(Tv tv);
}

interface Tv{
    public void getInfo();
}

class ChangHong implements Tv{

    public void getInfo() {
        System.out.println("长虹tv播放");
    }
}

class  MyPlay implements Play{

    public void play(Tv tv) {
        tv.getInfo();
    }
}
